package com.vcc.service.service;


import cn.hutool.core.date.DateTime;
import com.alibaba.fastjson2.JSONObject;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.service.IService;
import com.vcc.core.model.CountData;
import com.vcc.data.entity.Role;
import com.vcc.data.entity.UserCard;
import com.vcc.service.boss.response.userCard.UserCardStatisticsVo;
import com.vcc.service.client.vo.userCard.UserCardVo;

import java.math.BigDecimal;
import java.util.Collection;
import java.util.Date;
import java.util.List;

public interface UserCardService extends IService<UserCard> {

    UserCard getById(Long id);

    UserCard getByCardNumber(String cardNumber);

    UserCard getByOrderId(String orderId);

    UserCard getByChannelCardId(String channelCardId);

    UserCard getByChannelCardIdOrNullAndEmpty(String channelCardId);

    Boolean existsByChannelCardId(String channelCardId);

    Boolean updateRemarkById(Long id, String remark);

    Page<UserCard> paging(
            Page<UserCard> paging,
            Long userIds,
            String cardNumberLastFour,
            String remark,
            String startDate,
            String endDate,
            String cardStatus,
            Long id,
            String sortMap,
            Long cardTypeId,
            String channelCode);

    Page<UserCardVo> paging(
            Page<UserCardVo> paging,
            Long userId,
            Role role,
            Long targetUserId,
            String cardNumberLastFour,
            String remark,
            String startDate,
            String endDate,
            String cardStatus,
            Long id,
            Long groupId,
            String sortMap
    );

    Page<UserCard> paging(
            Integer pageNumber,
            Integer pageSize,
            Long userId,
            Role role,
            Long targetUserId,
            String cardNumberLastFour,
            String remark,
            String startDate,
            String endDate,
            String cardStatus,
            Long id,
            Long groupId,
            String sortMap
    );

    Boolean updateCardStatusById(String cardStatus, Long id);

    Boolean updateCardStatusByCardNumber(String cardStatus, String cardNumber);

    Boolean updateCardStatusByChannelCardId(String cardStatus, String channelCardId);

    Boolean updateUsableQuotaById(BigDecimal usableQuota, Long id);

    Boolean updateUsableQuotaByCardNumber(BigDecimal usableQuota, String cardNumber);

    Boolean updateUsableQuotaByChannelCardId(BigDecimal usableQuota, String channelCardId);

    Boolean updateUsableQuotaAndTotalLimitByChannelCardId(BigDecimal usableQuota,BigDecimal totalLimit, String channelCardId);

    Boolean updateUsableQuotaAndTotalLimitByChannelCardId(BigDecimal usableQuota,BigDecimal totalLimit,String cardStatus, String channelCardId);

    List<CountData> countById(Long userId);

    List<CountData> countById(Long userId, Date startDate, Date endDate);

    Long countByCardTypeIdAndUserId(Long cardTypeId, Long userId);

    Long countByUserId(Long userId);

    UserCard getByCardholderIdAndLastFourCardNumber(Long cardholderId, String lastFourCardNumber);

    List<UserCard> listByCardholderIdAndLastFourCardNumber(Long cardholderId, String lastFourCardNumber);

    UserCardStatisticsVo countByUserId(Long userId, Role role);

    List<JSONObject> cardTypeStatistics(DateTime startDate, DateTime endDate, Collection<Long> cardTypeIds);


    Long countByCardGroupId(Long cardGroupId);

    Boolean defaultSetGroupId(Long userId, Long targetGroupId);

    Boolean updateCardGroupId(Long sourceCardGroupId, Long targetCardGroupId);


    Boolean updateGroupIdIdById(Long id,Long sourceGroupId,Long targetGroupId);
}
